//
//  CustomView.m
//  Practice_jiugongge
//
//  Created by dllo on 15/10/19.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "CustomView.h"

@implementation CustomView

- (void)dealloc
{
    [_customImageView release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self createSubview] ;
    }
    return  self;
}

-(void)createSubview
{

    self.customImageView = [[UIImageView alloc] initWithFrame:self.bounds];
    self.customImageView.backgroundColor = [UIColor redColor];
    [self addSubview:self.customImageView];
    [self.customImageView release];
    self.customImageView.userInteractionEnabled = YES;
    
    UITapGestureRecognizer *tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
    [self.customImageView addGestureRecognizer:tap];
    [tap release];



}

- (void)tapAction
{

    NSInteger num = self.customImageView.tag;
    
    NSString *string = [NSString stringWithFormat:@"%ld", num];
    
    [self.cusDelegate present:string];

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
